package com.laivi.basic.module.sql;

import java.util.List;
import java.util.Map;

import com.laivi.basic.model.datastruct.ValueMap;
import com.laivi.basic.model.sql.Join;
import com.laivi.basic.model.sql.Page;
import com.laivi.basic.type.DBType;

/**
 * @author laivi.zhu@gmail.com
 * @date 2014-7-3
 * description:
 */

public interface DBDao {

	public List<ValueMap> query(String table,String field,Map<String,Object> where,String order);
	
	public Page<ValueMap> query(String table,String field,Map<String,Object> where,String order,int pageNum,int pageSize);
	
	public List<ValueMap> query(String table,String field,String where,String order);
	
	public Page<ValueMap> query(String table,String field,String where,String order,int pageNum,int pageSize);
	
	public List<ValueMap> query(String joinSql,String where,String order);
	
	public List<ValueMap> query(String joinSql,Map<String,Object> where,String order);
	
	public List<ValueMap> query(Join join,String where,String order);
	
	public List<ValueMap> query(Join join,Map<String,Object> where,String order);
	
	public Page<ValueMap> query(String joinSql,String where,String order,int pageNum,int pageSize);
	
	public Page<ValueMap> query(Join join,String where,String order,int pageNum,int pageSize);
	
	public Page<ValueMap> query(String joinSql,Map<String,Object> where,String order,int pageNum,int pageSize);
	
	public Page<ValueMap> query(Join join,Map<String,Object> where,String order,int pageNum,int pageSize);
	
	public Page<ValueMap> query(String sql,int pageNum,int pageSize);
	
	public List<ValueMap> query(String sql);
	
	public List<String> queryTables();
	
	public boolean isExist(String table);
	
	public List<String> queryViews();
	
	public List<ValueMap> queryColunm(String table);
	
	public List<ValueMap> queryParam(String sql,Object...objs);
	
	public int count(String table,String where);
	
	public int count(String table,Map<String,Object> where);
	
	public int count(String sql);
	
	public int countParam(String sql,Object...objs);
	
	public Object fun(String table,String where,String fun,String field);
	
	public Object fun(String table,Map<String,Object> where,String fun,String field);
	
	public ValueMap get(String sql);
	
	public ValueMap getParam(String sql,Object...objs);
	
	public ValueMap get(String table,String field,String where,String order);
	
	public ValueMap get(String joinSql,String where,String order);
	
	public ValueMap get(String table,String field,Map<String,Object> where,String order);
	
	public ValueMap get(String joinSql,Map<String,Object> where,String order);
	
	public DBType getDBType();
	
	public void add(String table,ValueMap value);
	
	public void add(String table,List<ValueMap> values);
	
	public long insert(String table,ValueMap value);
	
	public void update(String table,ValueMap value,String where);
	
	public void update(String table,ValueMap value,Map<String,Object> where);
	
	public void update(String table,List<ValueMap> values,List<Map<String,Object>> where);
	
	public void update(String table,List<ValueMap> values,String...whereFields);
	
	public void delete(String table,String where);
	
	public void delete(String table,Map<String,Object> where);
	
	public void execute(String sql);
	
	public String getSql(String table,String field,String where,String order);
	
	public String getSql(String joinSql,String where,String order);
	
	public String getBreakSql(String sql,int pageNum,int pageSize);
	
	public String mapToWhere(Map<String,Object> whereMap,boolean isLike);
	
	public String mapToWhere(Map<String,Object> whereMap);
	
	public void close();

}
